/** 
 * 评论相关请求模块
 * */ 
import request from "../utils/request";

// 获取评论或评论的回复
const getComments = (params) => {
    return request({
        method: 'GET',
        url: '/v1_0/comments',
        params: params
    })
}

// 对评论或评论回复点赞
const addCommentLike = (commentId) => {
    return request({
        method: 'POST',
        url: '/v1_0/comment/likings',
        data: {
            target: commentId
        }
    })
}

// 取消对评论或评论回复点赞
const deleteCommentLike = (commentId) => {
    return request({
        method: 'DELETE',
        url: `/v1_0/comment/likings/${commentId}`
    })
}

// 对文章或者评论进行评论
const addComment = (data) => {
    return request({
        method: 'POST',
        url: '/v1_0/comments',
        data: data
    })
}
export {getComments, addCommentLike, deleteCommentLike, addComment}